package com.imooc.bilibili.video;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.imooc.bilibili.domain.video.*;
import org.apache.mahout.cf.taste.common.TasteException;
import org.bytedeco.javacv.FrameGrabber;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 视频投稿记录表 服务类
 * </p>
 *
 * @author gcq
 * @since 2022-06-04
 */
public interface IVideoService extends IService<Video> {

    /**
     * 视频投稿
     *
     * @param video 视频
     */
    void addVideos(Video video);

    /**
     * 分页查询区域
     *
     * @param size 页码
     * @param no 页大小
     * @param area 区域
     * @return 结果
     */
    Page<Video> pageListVideos(Integer size, Integer no, String area);

    /**
     * 视频在线播放
     *
     * @param request
     * @param response
     * @param url
     */
    void viewVideoOnlineBySlices(HttpServletRequest request, HttpServletResponse response, String url) throws Exception;

    /**
     * 视频点赞
     *
     * @param currentUserId
     * @param videoId
     */
    void addVideoLikes(Long currentUserId, Long videoId);

    /**
     * 视频取消点赞
     *
     * @param currentUserId
     * @param videoId
     */
    void deleteVideoLikes(Long currentUserId, Long videoId);

    /**
     * 获取视频列表
     *
     * @param videoId
     * @param currentUserId
     * @return
     */
    Map<String, Object> getVideoLikes(Long videoId, Long currentUserId);

    /**
     * 用户收藏
     *
     * @param videoCollection
     */
    void addVideoCollection(VideoCollection videoCollection);

    /**
     * 取消收藏
     *
     * @param userId
     * @param videoId
     */
    void deleteVideoCollection(Long userId, Long videoId);

    /**
     * 查询视频收藏数量
     *
     * @param userId
     * @param videoId
     * @return
     */
    Map<String, Object> getVideoCollections(Long userId, Long videoId);

    /**
     * 视频投币
     *
     * @param videoCoin
     * @param userId
     */
    void addVideoCoins(VideoCoin videoCoin, Long userId);

    /**
     * 获取视频投币数量
     *
     * @param videoId
     * @param userId
     * @return
     */
    Map<String, Object> getVideoCoins(Long videoId, Long userId);

    /**
     * 添加用户评论
     *
     * @param videoComment
     */
    void addVideoComment(VideoComment videoComment);

    /**
     * 分页查询评论
     *
     * @param size
     * @param no
     * @param userId
     * @return
     */
    Page<VideoComment> pageListVideoComments(Integer size, Integer no, Long videoId);

    /**
     * 查询视频详细信息
     *
     * @param videoId
     * @return
     */
    Map<String, Object> getVideoDetails(Long videoId);

    /**
     * 添加视频访问记录
     *
     * @param videoView
     */
    void addVideoView(VideoView videoView, HttpServletRequest request);

    /**
     * 获取视频观看数量
     *
     * @param videoId
     * @return
     */
    Long getVideoViewCounts(Long videoId);

    /**
     * 基于用户视频内容推荐
     *
     * @param userId
     * @return
     */
    List<Video> recommend(Long userId) throws TasteException;

    /**
     * 生成视频黑白剪影
     *
     * @param videoId
     * @param fileMd5
     * @return
     */
    List<VideoBinaryPicture> convertVideoToImage(Long videoId, String fileMd5) throws Exception;
}
